<template>
  <view class="wrapper">
    <view class="none" v-if="!express.Success || !express.Traces || express.Traces.length === 0">
      查询不到相信信息
    </view>
    <view class="list" v-else>
      <view class="item" v-for="(item, index) in express.Traces" :key="index">
        <text class="time">{{ item.AcceptTime }}</text>
        <text class="info">{{ item.AcceptStation }}</text>
      </view>
    </view>
  </view>
</template>

<script>
import Arrow from '../../components/arrow'
import base64 from '../../util/base64'
import Order from '../../api/order'
const orderModel = new Order()
export default {
  components: {
    Arrow
  },
  data() {
    return {
      id: 0,
      express: {}
    }
  },
  onLoad(options) {
    this.id = options.id || 0
    this.fetch()
  },
  methods: {
    fetch() {
      orderModel.express({ logistics_id: this.id }).then(response => {
        let { data } = response
        data = base64.parse(data)
        console.log(data)
        this.express = JSON.parse(data.express)
      })
    }
  }
}
</script>

<style scoped lang="scss">
.wrapper {
  font-size: 24rpx;
  padding: 20rpx;
  background: $background_color;
  .none {
    color: #ccc;
    padding: 20rpx;
    background: white;
    border-radius: 10rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
  }
  .list {
    .item {
      padding: 20rpx;
      background: white;
      border-radius: 10rpx;
      margin-bottom: 10rpx;
      display: flex;
      flex-direction: column;
      .time {
        color: red;
        height: 20px;
      }
      .info {
        line-height: 20px;
      }
    }
  }
}
</style>
